<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        display: flex;
      }
    </style>
  </head>
  <body>
    <h2>选择你喜欢的专栏</h2>
    <div id="app">
      <div class="box">
        <div v-for="(item,index) in list">
          <input type="checkbox" name="hobby" v-model="item.check" />
          <label for="">{{item.name}}</label>
        </div>
      </div>
      <ul v-for="item in isCount">
        <li>{{item.name}}</li>
      </ul>
    </div>
    <script src="./vue.js"></script>

    <script>
      const app = new Vue({
        el: '#app',
        data: {
          list: [
            { name: '科幻', check: false },
            { name: '喜剧', check: false },
            { name: '动漫', check: true },
            { name: '冒险', check: false },
            { name: '科技', check: false },
            { name: '军事', check: false },
            { name: '奇闻', check: false },
          ],
        },
        computed: {
          isCount() {
            return (this.newArr = this.list.filter((item) => item.check))
          },
        },
        methods: {},
      })
    </script>
  </body>
</html>
